/**
 * Nuxt.js 配置文件
 */

 module.exports = {
    mode: 'spa',
    router: {
        // 自定义路由规则
        base: '/part3-module3/',
        extendRoutes (routes, reslove) {
             // 清除nuxt.js 默认生成的路由表规则
             routes.splice(0)

             routes.push(...[{
                 path:"/",
                 component: reslove(__dirname, "pages/layout"),
                 children:[{
                     path:'', // 默认子路由
                     name:'home',
                     component: reslove(__dirname, "pages/home")
                 },{
                    path:"/login",
                    name:"login",
                    component: reslove(__dirname, "pages/login")     
                 },{
                    path:"/register",
                    name:"register",
                    component: reslove(__dirname, "pages/login")     
                 },{
                     path:"/profile/:username",
                     name:'profile',
                     component: reslove(__dirname, "pages/profile")
                 },{
                     path:'/settings',
                     name:'settings',
                     component: reslove(__dirname, 'pages/settings')
                 },{
                     path:'/editor',
                     name:'editor',
                     component: reslove(__dirname, 'pages/editor')
                 },{
                    path:'/article/:slug',
                    name:'article',
                    component: reslove(__dirname, 'pages/article')
                }]
             }])
        },
        linkActiveClass: 'active'
    },
    // 注册插件
    plugins: [
        '~/plugins/request.js',
        '~/plugins/dayjs.js'
    ],
 }